{extend name="template/base" /}
{block name="nav"}{/block}
{block name="content"}
<div class="page-container">
    <div style="align-self: center">
        <h2>{$sttype}</h2>
    </div>
    <form class="form form-horizontal" id="updatepro" method="post" action="{:\\think\\Url::build('stockEdit')}">
            <input type="text" class="input-text" value="{$product.pid ?? ''}" placeholder="" name="pid" " style="width:0;height:0"/>
            <input type="text" class="input-text" value="{$product.stid ?? ''}" placeholder="" name="stid" " style="width:0;height:0"/>
            <input type="text" class="input-text" value="{$type ?? ''}" placeholder="" name="type" " style="width:0;height:0"/>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">商品名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$product.pname ?? ''}" placeholder="" name="name" readonly="true"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">所属分类：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$product.cname ?? ''}" placeholder="" name="cname" readonly="true"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">商品条码：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$product.barcode ?? ''}" placeholder="" name="barcode" readonly="true"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">计量单位：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$product.unit ?? ''}" placeholder="" name="unit" readonly="true"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">仓库库存/{$product.unit}：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$product.w_stock ?? ''}" placeholder="" name="w_stock" readonly="true"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">货架库存/{$product.unit}：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$product.s_stock ?? ''}" placeholder="" name="s_stock" readonly="true"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>出/入库数量/{$product.unit}：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="" placeholder="" name="count" datatype="n" ignore="ignore" nullmsg="请输入商品数量！"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="" placeholder="" name="remarks" ignore="ignore"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="cancelAction();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/admin/lib/Validform/5.3.2/Validform.min.js"></script>
<!--<script type="text/javascript" src="__STATIC__/admin/js/jquery-2.1.0.min.js"></script>-->
<script type="text/javascript" src="__STATIC__/admin/cs-js/selected.js"></script>
<script>
    $(function () {
        $("#updatepro").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                if(ret.code){
                    layer.msg(ret.msg);
                }
                else{
                    layer.msg('操作成功',{time:2000},'',location.href = '/index/Product/stockIndex');
//                    location.href = '{$Request.get.callback ?: \\think\\Url::build("/index/product/classShow")}';
                }
            }
        });
//        window.location.href = "/index/user/show";
    });
    function cancelAction(){
        window.location.href = "/index/product/index";
    }
</script>
{/block}